package fraction;

public class Solution {
    public int[] fraction(int[] cont) {
        int len = cont.length;
        int n =cont[len-1];
        int m = 1;
        for (int i = len-2; i >= 0; i--) {
            int t = m;
            m = n; // 变成倒数的形式
            n = cont[i]*m+t;
        }
        return new int[]{n,m};
    }
    // ai + 1/m == (ai+1)/m  aj + m/(ai+1)
}
